﻿using System;
using Mono.Cecil;
using Mono.Cecil.Cil;
using ProjScan.ScanRule.Attr;
using ProjScan.Submodules.CS_Check;

namespace ProjScan.ScanRule.CodeAnalysis
{
	// Token: 0x02000222 RID: 546
	[CSCheckRuleAttr]
	internal class StringModificationCall : InstructionRuleImpBase
	{
		// Token: 0x06000F6E RID: 3950 RVA: 0x00044A04 File Offset: 0x00042C04
		protected override bool AnalyzeInst(MethodDefinition method, Instruction inst, ref LineMapping failedInfo)
		{
			bool flag = inst.OpCode == OpCodes.Call || inst.OpCode == OpCodes.Callvirt;
			if (flag)
			{
				MethodReference methodReference = inst.Operand as MethodReference;
				bool flag2 = methodReference.DeclaringType.FullName == "System.String" && methodReference.ReturnType.Name == "String" && !methodReference.DeclaringType.Resolve().IsValueType;
				if (flag2)
				{
					failedInfo.Merge(LineMapping.GetMapping(method, inst));
					return false;
				}
			}
			return true;
		}
	}
}
